package edu.ustb.sql.sleuth.service.impl;

import edu.ustb.sql.sleuth.dao.ZipkinSpansDao;
import edu.ustb.sql.sleuth.entity.ZipkinSpans;
import edu.ustb.sql.sleuth.service.ZipkinSpansService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ShiZhe
 * @create 2020-10-17 19:35
 */
@Service
public class ZipkinSpansServiceImpl implements ZipkinSpansService {

    @Autowired
    private ZipkinSpansDao zipkinSpansDao;

//    @Override
//    public List<ZipkinSpans> findByTrace_id(Long trace_id) {
//        List<ZipkinSpans> zipkinSpansList = zipkinSpansDao.findByTrace_id(trace_id);
//        return zipkinSpansList;
//    }
    @Override
    public ZipkinSpans findById(Long trace_id) {
        return zipkinSpansDao.findById(trace_id).get();
    }

    @Override
    public void save(ZipkinSpans zipkinSpans) {
        zipkinSpansDao.save(zipkinSpans);
    }

    @Override
    public void update(ZipkinSpans zipkinSpans) {
        zipkinSpansDao.save(zipkinSpans);
    }

    @Override
    public void delete(Long trace_id) {
        zipkinSpansDao.deleteById(trace_id);
    }
}
